/*
 * Powered By XY
 * Since 2020
 */

package com.xy.biz.base.domain.req;

import com.xy.lang.validation.SaveChecks;
import com.xy.lang.validation.UpdateChecks;
import com.xy.lang.validation.annotation.AlertMessage;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 *
 *
 * @author zsp
 * @date 2020-5-24
 */
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Data
public class SaveDictRequest {

    /**
     * 字典Id
     */
    @NotNull(groups = {UpdateChecks.class}, message = "dictIdRequired")
    @AlertMessage(code = "dictIdRequired", msg = "字典Id不能为空")
    private Long dictId;
    /**
     * 字典分组编码
     */
    @NotBlank(groups = {SaveChecks.class}, message = "dictGroupCodeRequired")
    @AlertMessage(code = "dictGroupCodeRequired", msg = "字典分组编码不能为空")
    private String dictGroupCode;
    /**
     * 字典编码
     */
    @NotBlank(groups = {SaveChecks.class}, message = "dictCodeRequired")
    @AlertMessage(code = "dictCodeRequired", msg = "字典编码不能为空")
    private String dictCode;
    /**
     * 值
     */
    @NotBlank(groups = {SaveChecks.class, UpdateChecks.class}, message = "dictValueRequired")
    @AlertMessage(code = "dictValueRequired", msg = "字典值不能为空")
    private String dictValue;
    /**
     * 备注
     */
    private String memo;
    /**
     * 父字典Id
     */
    private Long parentDictId;
    /**
     * 排序号
     */
    private Integer sequence = 0;

    /**
     * 自动将字典id设为字典code
     */
    private boolean autoCodeFlag;
    /**
     * 字典value查重
     */
    private boolean repeatFlag;

    /**
     * 属性集合
     */
    private List<DictProperty> propertyList;

    @Data
    public static class DictProperty {

        /**
         * 字典属性Id
         */
        private Long dictPropertyId;
        /**
         * 属性名称
         */
        private String propertyName;

    }

}
